<template>
  <div class="home-container">
    <!-- 玻璃态背景容器 -->
    <div class="glass-background">
      <!-- 主内容容器 -->
      <div class="main-content">
        <!-- 系统标题卡片 -->
        <div class="title-card glass-panel">
          <h1 class="system-title">设备管理系统</h1>
          <p class="system-subtitle">高效、安全、智能的设备管理解决方案</p>
        </div>
        
        <!-- 功能卡片区域 - 紧凑布局 -->
        <div class="feature-section">
          <!-- 产品类型管理卡片 -->
          <div class="feature-card glass-panel" @click="$router.push('/product-types')">
            <div class="feature-icon type-icon">
              <Menu />
            </div>
            <h3 class="feature-title">产品类型管理</h3>
            <p class="feature-description">创建和管理产品分类，优化产品结构</p>
          </div>
          
          <!-- 产品管理卡片 -->
          <div class="feature-card glass-panel" @click="$router.push('/products')">
            <div class="feature-icon product-icon">
              <Goods />
            </div>
            <h3 class="feature-title">产品管理</h3>
            <p class="feature-description">全面管理产品信息，维护产品生命周期</p>
          </div>
          
          <!-- 设备管理卡片 -->
          <div class="feature-card glass-panel" @click="$router.push('/devices')">
            <div class="feature-icon device-icon">
              <Monitor />
            </div>
            <h3 class="feature-title">设备管理</h3>
            <p class="feature-description">实时监控设备状态，远程管理设备数据</p>
          </div>
          
          <!-- 可视化大屏卡片 -->
          <div class="feature-card glass-panel" @click="$router.push('/dashboard')">
            <div class="feature-icon dashboard-icon">
              <DataLine />
            </div>
            <h3 class="feature-title">可视化大屏</h3>
            <p class="feature-description">实时数据监控，直观展示设备运行状态</p>
          </div>
        </div>
        
        <!-- 底部信息卡片 -->
        <div class="info-card glass-panel">
          <div class="info-item">
            <div class="info-value">{{ totalProducts }}</div>
            <div class="info-label">总产品数</div>
          </div>
          <div class="info-item">
            <div class="info-value">{{ totalDevices }}</div>
            <div class="info-label">活跃设备</div>
          </div>
          <div class="info-item">
            <div class="info-value">{{ totalTypes }}</div>
            <div class="info-label">产品类型</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted, nextTick } from 'vue';
import { Menu, Goods, Monitor, DataLine } from '@element-plus/icons-vue';

// 模拟统计数据
const totalProducts = ref(128);
const totalDevices = ref(564);
const totalTypes = ref(8);

// 页面加载时的动画效果
onMounted(() => {
  nextTick(() => {
    const container = document.querySelector('.home-container');
    if (container) {
      container.classList.add('loaded');
    }
  });
});
</script>

<style scoped>
/* 全局容器 */
.home-container {
  height: 100vh;
  background: #f0f4f8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  opacity: 0;
  transition: opacity 0.8s ease;
  overflow: hidden;
  box-sizing: border-box;
}

.home-container.loaded {
  opacity: 1;
}

/* 玻璃背景容器 */
.glass-background {
  position: relative;
  width: 100%;
  max-width: 950px;
  height: 90vh;
  max-height: 600px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 24px;
  background: linear-gradient(135deg, #f0f4f8 0%, #e9ecef 100%);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
}

/* 主内容区域 */
.main-content {
  width: 100%;
  max-width: 900px;
  padding: 10px 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  position: relative;
  z-index: 1;
  margin: 0 auto;
  height: fit-content;
  box-sizing: border-box;
}

/* 通用玻璃面板样式 */
.glass-panel {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  position: relative;
}

.glass-panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.9);
}

/* 标题卡片样式 */
.title-card {
  padding: 15px 20px;
  text-align: center;
}

.system-title {
  font-size: 24px;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.system-subtitle {
  font-size: 14px;
  color: #7f8c8d;
  margin-bottom: 0;
  font-weight: 400;
}

/* 功能卡片区域 - 紧凑布局 */
.feature-section {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* 功能卡片样式 - 更紧凑 */
.feature-card {
  flex: 1;
  min-width: 200px;
  max-width: 280px;
  padding: 15px;
  height: auto;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  text-align: center;
}

.feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  margin-bottom: 10px;
}

.feature-card:hover .feature-icon {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.type-icon {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.product-icon {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.device-icon {
  background: linear-gradient(135deg, #fbc2eb 0%, #a6c1ee 100%);
}

.dashboard-icon {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.feature-title {
  font-size: 15px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 5px;
  letter-spacing: -0.1px;
}

.feature-description {
  font-size: 11px;
  color: #7f8c8d;
  line-height: 1.4;
  margin: 0;
  flex-grow: 1;
}

/* 信息卡片样式 - 更紧凑 */
.info-card {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 12px 15px;
  height: auto;
  min-height: 80px;
}

.info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  gap: 3px;
}

.info-value {
  font-size: 20px;
  font-weight: 700;
  color: #2c3e50;
  background: linear-gradient(90deg, #3498db, #2980b9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.info-label {
  font-size: 11px;
  color: #7f8c8d;
  font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .home-container {
    padding: 15px;
  }
  
  .main-content {
    padding: 20px;
    gap: 20px;
  }
  
  .glass-background {
    border-radius: 20px;
    min-height: 60vh;
  }
  
  .title-card {
    padding: 20px;
  }
  
  .system-title {
    font-size: 24px;
  }
  
  .system-subtitle {
    font-size: 14px;
  }
  
  .feature-section {
    flex-direction: column;
    gap: 12px;
  }
  
  .feature-card {
    min-width: 100%;
    padding: 16px;
    min-height: 160px;
  }
  
  .feature-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
    margin-bottom: 10px;
  }
  
  .feature-title {
    font-size: 15px;
  }
  
  .info-card {
    padding: 15px;
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .info-item {
    flex: 1 1 calc(33.333% - 10px);
    min-width: 100px;
  }
  
  .info-value {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 15px;
  }
  
  .glass-background {
    border-radius: 16px;
  }
  
  .title-card {
    padding: 15px;
  }
  
  .system-title {
    font-size: 20px;
  }
  
  .system-subtitle {
    font-size: 13px;
  }
  
  .feature-card {
    padding: 14px;
  }
  
  .info-item {
    flex: 1 1 100%;
    min-width: unset;
  }
  
  .info-value {
    font-size: 18px;
  }
}
</style>